package android.medicalcloud.com.yiapp.yilian.ui.ac;

import android.medicalcloud.com.yiapp.R;
import android.medicalcloud.com.yiapp.base.activity.BaseActivity;
import android.medicalcloud.com.yiapp.base.net.lisener.ViewNetCallBack;
import android.medicalcloud.com.yiapp.base.utils.StringTools;
import android.medicalcloud.com.yiapp.yilian.logic.UserController;
import android.medicalcloud.com.yiapp.yilian.utils.android.IntentTool;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import java.io.Serializable;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by wanggenlin on 17-5-18.
 */
public class LoginActivity extends BaseActivity implements ViewNetCallBack {

    EditText userNameEt;
    EditText pasEt;
    @Override
    protected void initView() {
//        ButterKnife.bind(this);
        userNameEt = (EditText)findViewById(R.id.userNameEt);
        pasEt = (EditText)findViewById(R.id.pasEt);
        findViewById(R.id.loginBt).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String name = userNameEt.getText().toString();
                String paw = pasEt.getText().toString();
                if (StringTools.isNullOrEmpty(name) || StringTools.isNullOrEmpty(paw)) {
                    Toast.makeText(LoginActivity.this, "用户名密码不能为空", Toast.LENGTH_LONG).show();
                    return;
                }
//                UserController.getInstance().login(LoginActivity.this, name, paw);
                IntentTool.startMain(LoginActivity.this);
                finish();
            }
        });
        findViewById(R.id.passwordTv).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                IntentTool.findPassword(LoginActivity.this);
            }
        });
    }

    @Override
    protected void initEvent() {

    }

    @Override
    protected void initData() {


    }


    @Override
    protected int getLayoutId() {
        return R.layout.ac_login;
    }

    @Override
    public void onConnectStart(Object o) {

    }

    @Override
    public void onConnectEnd() {

    }

    @Override
    public void onFail(Exception e, Object o, String reslut) {

    }

    @Override
    public void onData(Serializable result, int flag, boolean fromNet, Object o) {

    }
}
